home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / PASCAL / 2009.ZIP / STRLINK.ZIP / STRLINK.PAS < prev    next >
Pascal/Delphi Source File  |  1989-08-28  |  21KB  |  642 lines

  1. {$A+,B-,D+,E+,F-,I-,L+,N-,O-,R-,S+,V+}
  2. {$DEFINE TPRO5}
  3.  
  4. UNIT StrLink;
  5.  
  6. INTERFACE {section}
  7.  
  8. USES
  9.    {$IFDEF TPRO5}
  10.        TpString,
  11.    {$ENDIF}
  12.    Objects,
  13.    ObjectA,
  14.    StrObj;
  15.  
  16. TYPE
  17.    SortedOrderType = (ForwardOrder,
  18.               ReverseOrder,
  19.               AscendingOrder,
  20.               DescendingOrder);
  21.  
  22.    StrLinkList
  23.     = OBJECT(LinkList)
  24.       CurrentStrPtr     : StrObjectPtr;
  25.       UniqueStringsOnly : BOOLEAN;
  26.       SortedOrder       : SortedOrderType;
  27.       CaseMatters       : BOOLEAN;
  28.  
  29.       CONSTRUCTOR Init(UniqueStrings : BOOLEAN;
  30.                        SortSpecifier : SortedOrderType;
  31.                        IgnoreCase    : BOOLEAN);
  32.  
  33.       FUNCTION  GetSpecificString(NodePos : LONGINT) : STRING;
  34.       PROCEDURE DeleteSpecificString(NodePos : LONGINT);
  35.  
  36.       FUNCTION  ReadStrings(TheFilename : STRING) : BYTE;
  37.       FUNCTION  WriteStrings(TheFilename : STRING;
  38.                              AppendFile  : BOOLEAN) : BYTE;
  39.  
  40.       PROCEDURE AddString(TheStr : STRING);
  41.       PROCEDURE DeleteString(TheStr : STRING);
  42.       FUNCTION  Exists(TheStr : STRING) : BOOLEAN;
  43.       FUNCTION  ExistsSubstring(TheSubStr : STRING) : BOOLEAN;
  44.       PROCEDURE DeleteStringsWithoutSubstring(TheSubStr  : STRING;
  45.                                               IgnoreCase : BOOLEAN);
  46.       PROCEDURE DeleteStringsWithSubstring(TheSubStr  : STRING;
  47.                                            IgnoreCase : BOOLEAN);
  48.       PROCEDURE DeleteDuplicates;
  49.       PROCEDURE DeleteLeadNullStrings;
  50.       PROCEDURE DeleteNullStrings;
  51.       PROCEDURE DeleteTrailNullStrings;
  52.  
  53.       PROCEDURE InitCurrent;
  54.       FUNCTION  CurrentString : STRING;
  55.       PROCEDURE ChangeCurrentString(NewStr : STRING);
  56.       FUNCTION  FirstString : STRING;
  57.       FUNCTION  LastString : STRING;
  58.       PROCEDURE Advance;
  59.       PROCEDURE Retreat;
  60.       FUNCTION  MoreStrings : BOOLEAN;
  61.       FUNCTION  NoMoreStrings : BOOLEAN
  62.       END;
  63.  
  64.  
  65. IMPLEMENTATION {section}
  66.  
  67.  
  68. {$IFNDEF TPRO5}
  69. {============================================================================}
  70. FUNCTION  StUpCase(TheStr : STRING) : STRING;
  71.  
  72.    {Returns a string, converted to uppercase.}
  73.  
  74. VAR
  75.    Index : BYTE;
  76.  
  77. BEGIN {StUpCase}
  78. FOR Index := 1 TO LENGTH(TheStr)
  79.  DO TheStr[Index] := UPCASE(TheStr[Index]);
  80.  
  81. StUpCase := TheStr
  82. END; {StUpCase}
  83. {============================================================================}
  84. {$ENDIF}
  85.  
  86. {- - - - - - - - - - - - - - - - - - -  - - - - - - - - - - - - - - - - - - -}
  87.  
  88. {============================================================================}
  89. CONSTRUCTOR StrLinkList.Init(UniqueStrings : BOOLEAN;
  90.                              SortSpecifier : SortedOrderType;
  91.                              IgnoreCase    : BOOLEAN);
  92.  
  93.    {This procedure initializes the StrLinkList.}
  94.  
  95. BEGIN {StrLinkList.Init}
  96. CurrentStrPtr     := NIL;
  97.  
  98. UniqueStringsOnly := UniqueStrings;
  99. SortedOrder       := SortSpecifier;
  100. CaseMatters       := NOT IgnoreCase;
  101.  
  102. LinkList.Init
  103. END; {StrLinkList.Init}
  104. {============================================================================}
  105.  
  106. {============================================================================}
  107. FUNCTION  StrLinkList.GetSpecificString(NodePos : LONGINT) : STRING;
  108.  
  109.    {This function returns a string from the StrLinkList based on the position
  110. of a particular Str in the list.  The position is represented by NodePos.  It
  111. returns a null string if NodePos is <= 0 or if it is > Total.  CurrentPtr is
  112. set to the specified string.}
  113.  
  114. BEGIN {StrLinkList.GetSpecificString}
  115. {Initialize.}
  116. CurrentStrPtr := StrObjectPtr(Specific(NodePos));
  117.  
  118. IF (CurrentStrPtr = NIL)
  119.  THEN GetSpecificString := ''
  120.  ELSE GetSpecificString := CurrentStrPtr^.GetString
  121. END; {StrLinkList.GetSpecificString}
  122. {============================================================================}
  123.  
  124. {============================================================================}
  125. PROCEDURE StrLinkList.DeleteSpecificString(NodePos : LONGINT);
  126.  
  127.    {This procedure deletes a string from the StrLinkList based on the position
  128. of the node, represented by NodePos.  It does nothing if NodePos is <= 0 or if
  129. it is > Total.  CurrentPtr is set to NIL afterwards.}
  130.  
  131. BEGIN {StrLinkList.DeleteSpecificString}
  132. {Initialize.}
  133. CurrentStrPtr := StrObjectPtr(Specific(NodePos));
  134.  
  135. IF (CurrentStrPtr <> NIL)
  136.  THEN
  137.     BEGIN
  138.     Remove(CurrentStrPtr);
  139.     DISPOSE(CurrentStrPtr,Done);
  140.     CurrentStrPtr := NIL
  141.     END
  142. END; {StrLinkList.DeleteSpecificString}
  143. {============================================================================}
  144.  
  145. {============================================================================}
  146. FUNCTION  StrLinkList.ReadStrings(TheFilename : STRING) : BYTE;
  147.  
  148.    {Reads strings from TheFilename and adds them to the link list.  IORESULT
  149. is returned as the result.}
  150.  
  151. VAR
  152.    ReadFile : TEXT;
  153.    ReadBuf  : ARRAY [1..2048] OF CHAR;
  154.    ReadLine : STRING;
  155.  
  156. BEGIN {StrLinkList.ReadStrings}
  157. ASSIGN(ReadFile,TheFilename);
  158. RESET(ReadFile);
  159. SETTEXTBUF(ReadFile,ReadBuf);
  160.  
  161. WHILE NOT EOF(ReadFile)
  162.  DO BEGIN
  163.     READLN(ReadFile,ReadLine);
  164.     AddString(ReadLine)
  165.     END;
  166.  
  167. {Wrap up.}
  168. ReadStrings := IORESULT
  169. END; {StrLinkList.ReadStrings}
  170. {============================================================================}
  171.  
  172. {============================================================================}
  173. FUNCTION  StrLinkList.WriteStrings(TheFilename : STRING;
  174.                                    AppendFile  : BOOLEAN) : BYTE;
  175.  
  176.    {Writes strings from TheFilename and adds them to the link list.  IORESULT
  177. is returned as the result.}
  178.  
  179. VAR
  180.    WriteFile : TEXT;
  181.    WriteBuf  : ARRAY [1..2048] OF CHAR;
  182.    WriteLine : STRING;
  183.  
  184. BEGIN {StrLinkList.WriteStrings}
  185. ASSIGN(WriteFile,TheFilename);
  186. IF AppendFile
  187.  THEN SYSTEM.APPEND(WriteFile)
  188.  ELSE REWRITE(WriteFile);
  189. SETTEXTBUF(WriteFile,WriteBuf);
  190.  
  191. InitCurrent;
  192. WHILE MoreStrings
  193.  DO BEGIN
  194.     WRITELN(WriteFile,CurrentStrPtr^.GetString);
  195.     Advance
  196.     END;
  197.  
  198. {Wrap up.}
  199. WriteStrings := IORESULT
  200. END; {StrLinkList.WriteStrings}
  201. {============================================================================}
  202.  
  203. {============================================================================}
  204. PROCEDURE   StrLinkList.AddString(TheStr : STRING);
  205.  
  206.    {This procedure stores TheStr in the StrLinkList.  It does nothing if the
  207. string is redundant AND UniqueStringsOnly is set to TRUE.  CurrentPtr is
  208. undefined after making this call.}
  209.  
  210. BEGIN {StrLinkList.AddString}
  211. IF (UniqueStringsOnly AND Exists(TheStr))
  212.  THEN EXIT; {no need to hang around here, eh?}
  213.  
  214. IF (First = NIL)
  215.  THEN
  216.     Insert(NEW(StrObjectPtr,Init(TheStr)))
  217.  ELSE
  218.     CASE SortedOrder OF
  219.       ForwardOrder :
  220.     Append(NEW(StrObjectPtr,Init(TheStr)));
  221.       ReverseOrder :
  222.     Insert(NEW(StrObjectPtr,Init(TheStr)));
  223.       AscendingOrder :
  224.         BEGIN
  225.         CurrentStrPtr := StrObjectPtr(First);
  226.         IF CaseMatters
  227.          THEN
  228.             WHILE (MoreStrings
  229.              AND (CurrentStrPtr^.GetString < TheStr))
  230.              DO Advance
  231.          ELSE
  232.             {$IFDEF TPRO5}
  233.                 WHILE (MoreStrings
  234.                  AND (CompUCString(CurrentStrPtr^.GetString,TheStr) = Less))
  235.                   DO Advance;
  236.             {$ELSE}
  237.                 WHILE (MoreStrings
  238.                  AND (StUpCase(CurrentStrPtr^.GetString) < StUpCase(TheStr)))
  239.                   DO Advance;
  240.             {$ENDIF}
  241.  
  242.         {CurrentStrPtr now points to the first Str coming after TheStr, or it
  243.            has a NIL value.}
  244.         IF NoMoreStrings
  245.          THEN Append(NEW(StrObjectPtr,Init(TheStr)))
  246.          ELSE Before(NEW(StrObjectPtr,Init(TheStr)),CurrentStrPtr)
  247.         END;
  248.       DescendingOrder :
  249.         BEGIN
  250.         CurrentStrPtr := StrObjectPtr(First);
  251.         IF CaseMatters
  252.          THEN
  253.             WHILE (MoreStrings
  254.              AND (CurrentStrPtr^.GetString > TheStr))
  255.              DO Advance
  256.          ELSE
  257.             {$IFDEF TPRO5}
  258.                 WHILE (MoreStrings
  259.                  AND (CompUCString(CurrentStrPtr^.GetString,
  260.                                    TheStr) = Greater))
  261.                   DO Advance;
  262.             {$ELSE}
  263.                 WHILE (MoreStrings
  264.                  AND (StUpCase(CurrentStrPtr^.GetString) > StUpCase(TheStr)))
  265.                   DO Advance;
  266.             {$ENDIF}
  267.  
  268.         {CurrentStrPtr now points to the first Str coming after TheStr, or it
  269.            has a NIL value.}
  270.         IF NoMoreStrings
  271.          THEN Append(NEW(StrObjectPtr,Init(TheStr)))
  272.          ELSE Before(NEW(StrObjectPtr,Init(TheStr)),CurrentStrPtr)
  273.         END;
  274.      END; {CASE}
  275. END; {AddString}
  276. {============================================================================}
  277.  
  278. {============================================================================}
  279. PROCEDURE   StrLinkList.DeleteString(TheStr : STRING);
  280.  
  281.    {This procedure deletes a string from the StrLinkList.  It does nothing if
  282. the string doesn't exist.  CurrentPtr is NIL after making this call.}
  283.  
  284. BEGIN {StrLinkList.DeleteString}
  285. IF Exists(TheStr)
  286.  THEN
  287.     BEGIN
  288.     CurrentStrPtr := StrObjectPtr(First);
  289.     WHILE (CurrentStrPtr^.GetString <> TheStr)
  290.      DO CurrentStrPtr := StrObjectPtr(CurrentStrPtr^.Next);
  291.  
  292.     {CurrentStrPtr now points to the proper string.}
  293.     Remove(CurrentStrPtr);
  294.     DISPOSE(CurrentStrPtr,Done);
  295.     CurrentStrPtr := NIL
  296.     END
  297. END; {StrLinkList.DeleteString}
  298. {============================================================================}
  299.  
  300. {============================================================================}
  301. FUNCTION    StrLinkList.Exists(TheStr : STRING) : BOOLEAN;
  302.  
  303.    {This function determines if the string is on the StrLinkList.}
  304.  
  305. VAR
  306.    TempBoolean : BOOLEAN;
  307.  
  308. BEGIN {StrLinkList.Exists}
  309. {Initialize.}
  310. CurrentStrPtr := StrObjectPtr(First);
  311.  
  312. IF (First = NIL)
  313.  THEN
  314.     Exists := FALSE
  315.  ELSE
  316.     BEGIN
  317.     TempBoolean := FALSE;
  318.  
  319.     REPEAT
  320.         IF (CurrentStrPtr^.GetString = TheStr)
  321.          THEN TempBoolean := TRUE;
  322.          {ELSE leave TempBoolean alone}
  323.  
  324.         CurrentStrPtr := StrObjectPtr(Next(CurrentStrPtr))
  325.      UNTIL (TempBoolean OR NoMoreStrings);
  326.  
  327.     Exists := TempBoolean
  328.     END
  329. END; {StrLinkList.Exists}
  330. {============================================================================}
  331.  
  332. {============================================================================}
  333. FUNCTION    StrLinkList.ExistsSubstring(TheSubStr : STRING) : BOOLEAN;
  334.  
  335.    {This function determines if a given substring is on the StrLinkList.  If
  336. TheSubString is null and at least one string exists on the list, then the
  337. function returns as TRUE.}
  338.  
  339. VAR
  340.    TempBoolean : BOOLEAN;
  341.  
  342. BEGIN {StrLinkList.ExistsSubstring}
  343. {Initialize.}
  344. CurrentStrPtr := StrObjectPtr(First);
  345.  
  346. IF (First = NIL)
  347.  THEN
  348.     ExistsSubstring := FALSE
  349.  ELSE
  350.     IF (TheSubStr = '')
  351.      THEN
  352.         ExistsSubstring := TRUE
  353.      ELSE
  354.         BEGIN
  355.         TempBoolean := FALSE;
  356.  
  357.         REPEAT
  358.             IF (POS(TheSubStr,CurrentStrPtr^.GetString) > 0)
  359.              THEN TempBoolean := TRUE;
  360.              {ELSE leave TempBoolean alone}
  361.  
  362.             CurrentStrPtr := StrObjectPtr(Next(CurrentStrPtr))
  363.          UNTIL (TempBoolean OR NoMoreStrings);
  364.  
  365.         ExistsSubstring := TempBoolean
  366.         END
  367. END; {StrLinkList.ExistsSubstring}
  368. {============================================================================}
  369.  
  370. {============================================================================}
  371. PROCEDURE StrLinkList.DeleteStringsWithoutSubstring(TheSubStr  : STRING;
  372.                                                     IgnoreCase : BOOLEAN);
  373.  
  374.    {This procedure deletes any string that doesn't contain TheSubStr as part
  375. of the string.  No strings are deleted if TheSubString is a null string.  The
  376. IgnoreCase variable dictates whether upper/lower case is relevant.}
  377.  
  378. VAR
  379.    Index : LONGINT;
  380.  
  381. BEGIN {StrLinkList.DeleteStringsWithoutSubstring}
  382. {Initialize.}
  383. IF ((TheSubStr = '') OR (First = NIL))
  384.  THEN EXIT; {no need to hang around, eh?}
  385. InitCurrent;
  386. Index := 1;
  387.  
  388. IF IgnoreCase
  389.  THEN
  390.     BEGIN
  391.     TheSubStr := StUpCase(TheSubStr);
  392.     WHILE (Index <= Total(First))
  393.      DO IF (POS(TheSubStr,StUpCase(GetSpecificString(Index))) = 0)
  394.          THEN DeleteSpecificString(Index)
  395.          ELSE INC(Index)
  396.     END
  397.  ELSE
  398.     WHILE (Index <= Total(First))
  399.      DO IF (POS(TheSubStr,GetSpecificString(Index)) = 0)
  400.          THEN DeleteSpecificString(Index)
  401.          ELSE INC(Index)
  402. END; {StrLinkList.DeleteStringsWithoutSubstring}
  403. {============================================================================}
  404.  
  405. {============================================================================}
  406. PROCEDURE StrLinkList.DeleteStringsWithSubstring(TheSubStr  : STRING;
  407.                                                  IgnoreCase : BOOLEAN);
  408.  
  409.    {This procedure deletes any string that DOES contain TheSubStr as part of
  410. the string.  No strings are deleted if TheSubString is a null string.  The
  411. IgnoreCase variable dictates whether upper/lower case is relevant.}
  412.  
  413. VAR
  414.    Index : LONGINT;
  415.  
  416. BEGIN {StrLinkList.DeleteStringsWithSubstring}
  417. {Initialize.}
  418. IF ((TheSubStr = '') OR (First = NIL))
  419.  THEN EXIT; {no need to hang around, eh?}
  420. InitCurrent;
  421. Index := 1;
  422.  
  423. IF IgnoreCase
  424.  THEN
  425.     BEGIN
  426.     TheSubStr := StUpCase(TheSubStr);
  427.     WHILE (Index <= Total(First))
  428.      DO IF (POS(TheSubStr,StUpCase(GetSpecificString(Index))) > 0)
  429.          THEN DeleteSpecificString(Index)
  430.          ELSE INC(Index)
  431.     END
  432.  ELSE
  433.     WHILE (Index <= Total(First))
  434.      DO IF (POS(TheSubStr,GetSpecificString(Index)) > 0)
  435.          THEN DeleteSpecificString(Index)
  436.          ELSE INC(Index)
  437. END; {StrLinkList.DeleteStringsWithSubstring}
  438. {============================================================================}
  439.  
  440. {============================================================================}
  441. PROCEDURE StrLinkList.DeleteDuplicates;
  442.  
  443.    {This procedure deletes duplicate strings from the list.}
  444.  
  445. VAR
  446.    MasterIndex  : LONGINT;
  447.    CurrentIndex : LONGINT;
  448.    TestStr      : STRING;
  449.  
  450. BEGIN {StrLinkList.DeleteDuplicates}
  451. {Initialize.}
  452. MasterIndex := 1;
  453. InitCurrent;
  454. IF (UniqueStringsOnly OR (Total(First) < 2))
  455.  THEN EXIT; {no need to hang around here, eh?}
  456.  
  457. {If we get this far, we have at least two strings on the list.}
  458. REPEAT
  459.     TestStr       := GetSpecificString(MasterIndex);  {sets CurrentStrPtr}
  460.     CurrentIndex  := SUCC(MasterIndex);
  461.     CurrentStrPtr := StrObjectPtr(Specific(CurrentIndex));
  462.  
  463.     REPEAT
  464.         IF (CurrentStrPtr^.GetString = TestStr)
  465.          THEN
  466.             BEGIN
  467.             DeleteSpecificString(CurrentIndex);
  468.             CurrentStrPtr := StrObjectPtr(Specific(CurrentIndex))
  469.             END
  470.          ELSE
  471.             BEGIN
  472.             Advance;
  473.             INC(CurrentIndex)
  474.             END
  475.      UNTIL (CurrentIndex > Total(First));
  476.  
  477.     INC(MasterIndex)
  478.  UNTIL (MasterIndex >= Total(First));
  479.  
  480. InitCurrent
  481. END; {StrLinkList.DeleteDuplicates}
  482. {============================================================================}
  483.  
  484. {============================================================================}
  485. PROCEDURE StrLinkList.DeleteLeadNullStrings;
  486.  
  487.    {This procedure deletes leading null strings from the list.  Null strings
  488. that exist past the first non-null string in the list are left alone.}
  489.  
  490. BEGIN {StrLinkList.DeleteLeadNullStrings}
  491. WHILE ((First <> NIL)
  492.  AND (GetSpecificString(1) = ''))
  493.  DO DeleteSpecificString(1)
  494. END; {StrLinkList.DeleteLeadNullStrings}
  495. {============================================================================}
  496.  
  497. {============================================================================}
  498. PROCEDURE StrLinkList.DeleteNullStrings;
  499.  
  500.    {This procedure deletes null strings from the list.}
  501.  
  502. VAR
  503.    Index : LONGINT;
  504.  
  505. BEGIN {StrLinkList.DeleteNullStrings}
  506. {Initialize.}
  507. IF (First = NIL)
  508.  THEN EXIT; {no need to hang around, eh?}
  509. InitCurrent;
  510. Index := 1;
  511.  
  512. WHILE (Index <= Total(First))
  513.  DO IF (GetSpecificString(Index) = '')
  514.      THEN DeleteSpecificString(Index)
  515.      ELSE INC(Index)
  516. END; {StrLinkList.DeleteNullStrings}
  517. {============================================================================}
  518.  
  519. {============================================================================}
  520. PROCEDURE StrLinkList.DeleteTrailNullStrings;
  521.  
  522.    {This procedure deletes Trailing null strings from the list.  Null strings
  523. that exist before the last non-null string in the list are left alone.}
  524.  
  525. BEGIN {StrLinkList.DeleteTrailNullStrings}
  526. WHILE ((Last <> NIL)
  527.  AND (GetSpecificString(Total(First)) = ''))
  528.  DO DeleteSpecificString(Total(First))
  529. END; {StrLinkList.DeleteTrailNullStrings}
  530. {============================================================================}
  531.  
  532. {============================================================================}
  533. PROCEDURE  StrLinkList.InitCurrent;
  534.  
  535.    {This function initializes CurrentStrPtr to point to the first string on
  536. the LinkList.  NoMoreStrings will return TRUE if there are no strings on the
  537. list.}
  538.  
  539. BEGIN {StrLinkList.InitCurrent}
  540. CurrentStrPtr := StrObjectPtr(First);
  541. END; {StrLinkList.InitCurrent}
  542. {============================================================================}
  543.  
  544. {============================================================================}
  545. FUNCTION    StrLinkList.CurrentString : STRING;
  546.  
  547.    {This function returns the current string in the StrLinkList.  It returns
  548. a null string if the CurrentStrPtr is NIL.  It is up to the calling routine
  549. to use the NoMoreStrings function to see if a string is currently available.}
  550.  
  551. BEGIN {StrLinkList.CurrentString}
  552. IF NoMoreStrings
  553.  THEN CurrentString := ''
  554.  ELSE CurrentString := CurrentStrPtr^.GetString
  555. END; {StrLinkList.CurrentString}
  556. {============================================================================}
  557.  
  558. {============================================================================}
  559. PROCEDURE StrLinkList.ChangeCurrentString(NewStr : STRING);
  560.  
  561.    {This procedure changes the current string to the new string.}
  562.  
  563. BEGIN {StrLinkList.ChangeCurrentString}
  564. CurrentStrPtr^.ChangeString(NewStr)
  565. END; {StrLinkList.ChangeCurrentString}
  566. {============================================================================}
  567.  
  568. {============================================================================}
  569. FUNCTION    StrLinkList.FirstString : STRING;
  570.  
  571.    {This function simply returns the first String in the LinkList.  It returns
  572. a null string if there are no strings in the list.  It is up to the calling
  573. routine to determine for itself if there are no strings.}
  574.  
  575. BEGIN {StrLinkList.FirstString}
  576. CurrentStrPtr := StrObjectPtr(First);
  577. IF NoMoreStrings
  578.  THEN FirstString := ''
  579.  ELSE FirstString := CurrentStrPtr^.GetString
  580. END; {StrLinkList.FirstString}
  581. {============================================================================}
  582.  
  583. {============================================================================}
  584. FUNCTION    StrLinkList.LastString : STRING;
  585.  
  586.    {This function simply returns the last string in the LinkList.  It returns
  587. a null string if there are no strings in the list.  It is up to the calling
  588. routine to determine for itself if there are no strings.}
  589.  
  590. BEGIN {StrLinkList.LastString}
  591. CurrentStrPtr := StrObjectPtr(Last);
  592. IF NoMoreStrings
  593.  THEN LastString := ''
  594.  ELSE LastString := CurrentStrPtr^.GetString
  595. END; {StrLinkList.LastString}
  596. {============================================================================}
  597.  
  598. {============================================================================}
  599. PROCEDURE   StrLinkList.Advance;
  600.  
  601.    {This procedure simply moves to the next string in the StrLinkList.}
  602.  
  603. BEGIN {StrLinkList.Advance}
  604. CurrentStrPtr := StrObjectPtr(Next(CurrentStrPtr))
  605. END; {StrLinkList.Advance}
  606. {============================================================================}
  607.  
  608. {============================================================================}
  609. PROCEDURE   StrLinkList.Retreat;
  610.  
  611.    {This procedure simply moves to the previous string in the StrLinkList.}
  612.  
  613. BEGIN {StrLinkList.Retreat}
  614. CurrentStrPtr := StrObjectPtr(Prev(CurrentStrPtr))
  615. END; {StrLinkList.Retreat}
  616. {============================================================================}
  617.  
  618. {============================================================================}
  619. FUNCTION  StrLinkList.MoreStrings : BOOLEAN;
  620.  
  621.    {This function tells the calling routine if there are still some strings
  622. left to go on the link list.}
  623.  
  624. BEGIN {StrLinkList.MoreStrings}
  625. MoreStrings := (CurrentStrPtr <> NIL)
  626. END; {StrLinkList.MoreStrings}
  627. {============================================================================}
  628.  
  629. {============================================================================}
  630. FUNCTION  StrLinkList.NoMoreStrings : BOOLEAN;
  631.  
  632.    {This function is just the opposite of MoreStrings.  It tells the calling
  633. routine if the string link list has been exhausted.}
  634.  
  635. BEGIN {StrLinkList.NoMoreStrings}
  636. NoMoreStrings := (CurrentStrPtr = NIL)
  637. END; {StrLinkList.NoMoreStrings}
  638. {============================================================================}
  639.  
  640.  
  641. END. {StrLink}
  642.